﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using WFExtended.Activities;
using WFExtended.Tests.Model;
using Microsoft.Activities.UnitTesting;
using System.ServiceModel;
using System.ServiceModel.Channels;
using System.Activities;

namespace WFExtended.Tests.Activities
{
    [TestClass]
    public class WcfDiscoveryProxyTest : AWcfProxyActivityTest
    {
        public WcfDiscoveryProxyTest()
        {
        }

        [TestMethod]
        public void WcfDiscoveryStringProxyWithoutInvokerValidationTest()
        {
            base.WcfStringProxyWithoutInvokerValidationTest<WcfDiscoveryProxy<String>>();
        }

        [TestMethod]
        public void WcfDiscoveryMockServiceProxyWithoutInvokerValidationTest()
        {
            base.WcfMockServiceProxyWithoutInvokerValidationTest<WcfDiscoveryProxy<IMockService>>();
        }

        [TestMethod]
        public void WcfDiscoveryMockServiceProxyWithInvokerValidationTest()
        {
            base.WcfMockServiceProxyWithInvokerValidationTest<WcfDiscoveryProxy<IMockService>, IMockService>();
        }

        [TestMethod]
        public void WcfDiscoveryMockServiceProxyWithGenericInvokerValidationTest()
        {
            base.WcfMockServiceProxyWithGenericInvokerValidationTest<WcfDiscoveryProxy<IMockService>, IMockService>();
        }

        [TestMethod]
        public void WcfDiscoveryMockServiceNoPersistenceProxyValidationTest()
        {
            base.WcfMockServiceNoPersistenceProxyValidationTest<WcfDiscoveryProxy<IMockService>, IMockService>();
        }

        [TestMethod]
        [ExpectedException(typeof(ArgumentException))]
        public void WcfDiscoveryMockServiceProxyWithoutArgumentExecutionTest()
        {
            var host = WorkflowInvokerTest.Create(new WcfDiscoveryProxy<IMockService>());
            host.TestActivity();
        }

        [TestMethod]
        public void WcfDiscoveryMockServiceProxyExecutionTest()
        {
            var host = WorkflowInvokerTest.Create(new WcfDiscoveryProxy<IMockService>());
            host.InArguments.Binding = new BasicHttpBinding();
            host.TestActivity();
        }

    }
}
